package com.ruoyi.chatgpt.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.chatgpt.mapper.GptMessageMapper;
import com.ruoyi.chatgpt.domain.GptMessage;
import com.ruoyi.chatgpt.service.IGptMessageService;

/**
 * keyService业务层处理
 * 
 * @author ruoyi
 * @date 2023-06-29
 */
@Service
public class GptMessageServiceImpl implements IGptMessageService 
{
    @Autowired
    private GptMessageMapper gptMessageMapper;

    /**
     * 查询key
     * 
     * @param id key主键
     * @return key
     */
    @Override
    public GptMessage selectGptMessageById(Long id)
    {
        return gptMessageMapper.selectGptMessageById(id);
    }

    /**
     * 查询key列表
     * 
     * @param gptMessage key
     * @return key
     */
    @Override
    public List<GptMessage> selectGptMessageList(GptMessage gptMessage)
    {
        return gptMessageMapper.selectGptMessageList(gptMessage);
    }

    /**
     * 新增key
     * 
     * @param gptMessage key
     * @return 结果
     */
    @Override
    public int insertGptMessage(GptMessage gptMessage)
    {
        gptMessage.setCreateTime(DateUtils.getNowDate());
        return gptMessageMapper.insertGptMessage(gptMessage);
    }

    /**
     * 修改key
     * 
     * @param gptMessage key
     * @return 结果
     */
    @Override
    public int updateGptMessage(GptMessage gptMessage)
    {
        gptMessage.setUpdateTime(DateUtils.getNowDate());
        return gptMessageMapper.updateGptMessage(gptMessage);
    }

    /**
     * 批量删除key
     * 
     * @param ids 需要删除的key主键
     * @return 结果
     */
    @Override
    public int deleteGptMessageByIds(Long[] ids)
    {
        return gptMessageMapper.deleteGptMessageByIds(ids);
    }

    /**
     * 删除key信息
     * 
     * @param id key主键
     * @return 结果
     */
    @Override
    public int deleteGptMessageById(Long id)
    {
        return gptMessageMapper.deleteGptMessageById(id);
    }

    @Override
    public List<GptMessage> queryGptMessageList(Long chatId) {
        return gptMessageMapper.queryGptMessageList(chatId);
    }
}
